package com.rattsoftware.client.model;

import com.extjs.gxt.ui.client.data.BaseModel;
import com.rattsoftware.server.admin.model.Department;

public class DepartmentSummary extends BaseModel {

	/**
	 * Base model representation of a given course.
	 */
	private static final long serialVersionUID = 1L;

	private Department department;

	public DepartmentSummary(Department department) {
		this.setDepartment(department); 
		setId (department.getId());
        setData("departmentName", department.getName());
        setData("departmentDescription", department.getDescription());
        setData("noOfCourses", department.getNumOfCourses());
        setData("departmentHead", department.getHod());
	}
	
	public String getId() {
		return get("departmentId");
	}
	
	public void setId(String id) {
		set("departmentId", id);
	}

    public <X> X setData(String name, X value) {
        return set(name, value);
    }

	public void setDepartment(Department department) {
		this.department = department;
	}

	public Department getDepartment() {
		return department;
	}
	
	public String getDepartmentName() {
		return get("departmentName");
	}
	
	public String getDepartmentDescription() {
		return get("departmentDescription");
	}
	
	public String getNoOfCourseUnits() {
		return get("noOfCourseUnits");
	}
	
	public String getDepartmentHead() {
		return get("departmentHead");
	}
	
	public String getNoOfCourses() {
		return get("noOfCourses");
	}
	
	public void updateDepartmentSummary(Department department) {
		setId (department.getId());
        setData("departmentName", department.getName());
        setData("departmentDescription", department.getDescription());
        setData("noOfCourses", department.getNumOfCourses());
        setData("departmentHead", department.getHod());
	}
}
